<template>
	<view class="main">
		<view class="title"><p>考试安排</p></view>
		<view class="exam-all">
			<view class="exam-item" v-for="exam in examList">
				<view class="exam-name">
					<p>{{exam.examName}}</p>
				</view>
				<view class="exam-site">
					<p>位置：{{exam.site}}</p>
				</view>
				<view class="exam-time">
					<p><span class="time-title">时间：</span>{{exam.examDate}} {{exam.examTime}}</p>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {ExamService} from "../../services/api.service";
	import {needLogin} from "../../common/utils/utils";

	export default {
		data() {
			return {
				examList: []
			}
		},
		onShow() {
			needLogin(this)
		},
		onLoad() {
			const _this = this
			uni.startPullDownRefresh({
				success() {
					_this.getExamSchedule()
				},
				complete() {
					setTimeout(() => {
						uni.stopPullDownRefresh();
					}, 500)
				}
			})
		},

		methods: {
			// 获取考试安排
			getExamSchedule() {
				ExamService.get()
					.then(res => {
						console.log(res)
						if(res.code === 0) {
							this.examList = res.data.allExamScheduleList
							console.log(this.examList)
						}
					}).catch(err => {
						console.log(err)
					})
			}
		}
	}
</script>

<style>
.main{
	width: 100%;
}
.title {
	color: black;
	font-size: 20px;
	margin-left: 10px;
	margin-top: 10px;
}
.exam-item {
	margin: 10px 10px;
	padding: 10px;
	background: #ffffff;
	border-radius: 8px;
}
.exam-item .exam-name {
	font-size: 18px;
	font-weight: 600;
	color: #212f6c;
	line-height: 30px;
}
.exam-item .exam-site {
	font-size: 14px;
	color: #888c9e;
	line-height: 24px;
}
.exam-item .exam-time {
	font-size: 14px;
	line-height: 24px;
	color: #ce8685;
}
.exam-item .exam-time .time-title {
	color: #888c9e;
}
</style>
